package com.data.modules.feign;

import com.alibaba.fastjson.JSONObject;
import com.data.common.api.vo.CrmResult;
import com.data.common.crm.entity.AdminDeptVo;
import com.data.common.entity.BasePage;
import com.data.modules.ai.entity.AdminDeptBO;
import com.data.modules.emp.entity.AdminDeptVO;
import com.data.modules.emp.entity.SimpleDept;
import com.data.modules.emp.entity.SimpleUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;

/**
 * @Description
 * @Date 2022-2-22 10:43:47
 * @Author chj
 */
@SuppressWarnings("ALL")
@Component
@FeignClient(name = "admin", url = "${crm.admin-url:}")
public interface AdminService {

    /**
     * 查询需要统计的RP月度员工
     *
     * @return
     */
    @PostMapping(value = "/adminUser/queryRpUserStatisList")
    CrmResult<List<JSONObject>> queryRpUserStatisList(@RequestBody String month);

    /**
     * 通过月份查询rp员工列表(包括当月禁用掉的)-不分页
     *
     * @param month
     * @return
     */
    @GetMapping("/adminUser/queryRpUserStatusList")
    CrmResult<List<JSONObject>> queryRpUserStatusList(@RequestParam String month);

    /**
     * 修改用户离职时间-提供给企业微信
     *
     * @param mobile
     * @param depaTime
     * @return
     */
    @PostMapping(value = "/adminUser/updateDepaTime")
    CrmResult updateDepaTime(@RequestParam("mobile") String mobile, @RequestParam("depaTime") String depaTime);

    /**
     * 查询rp部门/城市列表树
     *
     * @return
     */
    @GetMapping("/adminDept/queryRpDeptTree")
    CrmResult<List<AdminDeptVO>> queryRpDeptTree(@RequestParam(value = "pid", required = false) Integer pid);

    /**
     * 查询rp部门/区域/城市列表树
     *
     * @param pid
     * @return
     */
    @GetMapping("/adminDept/queryRpDeptTreeAll")
    CrmResult<List<AdminDeptVO>> queryRpDeptTreeAll(@RequestParam(value = "pid", required = false) Integer pid);

    /**
     * 模糊查询 主体列表
     *
     * @param companyName
     * @param deptType
     * @return
     */
    @PostMapping("/adminDept/queryDeptSubjectsPage")
    CrmResult<BasePage<AdminDeptVo>> queryDeptSubjectsPage(@RequestBody AdminDeptBO bo);

    /**
     * 递归查询 某层级子集
     *
     * @param deptId
     * @param deptLevel
     * @return
     */
    @PostMapping("/adminDept/getChildDeptByDeptId")
    CrmResult<BasePage<AdminDeptVo>> getChildDeptByDeptId(@RequestBody AdminDeptBO bo);


    /**
     * 查询需要统计的RP月度员工
     *
     * @return
     */
    @PostMapping(value = "/adminDept/queryDeptStationsV2")
    CrmResult<List<AdminDeptVO>> queryDeptStationsV2(@RequestParam("deptIds") @NotNull String deptIds
            , @RequestHeader String reqSource, Integer isDisable);

    /**
     * 查询需要统计的RP月度员工
     *
     * @return
     */
    @PostMapping(value = "/adminDept/getParentDeptListByDept")
    List<AdminDeptVo> getParentDeptListByDept(@RequestParam("deptId") @NotNull String deptId);

    /**
     * 根据ids查询用户信息
     *
     * @param ids id列表
     * @return data
     */
    @PostMapping(value = "/adminUser/queryUserByIds")
    CrmResult<List<SimpleUser>> queryUserByIds(@RequestBody Collection<Long> ids);

    /**
     * 根据ids查询部门信息
     *
     * @param ids id列表
     * @return data
     */
    @PostMapping(value = "/adminDept/queryDeptByIds")
    CrmResult<List<SimpleDept>> queryDeptByIds(@RequestBody Collection<Integer> ids);

    @PostMapping({"/adminUserAccount/queryUserRoles"})
    List<String> queryUserRoles(@RequestParam("userId") Long userId);

}
